    <div class="row">
      <div class="col-12">
        <h2 class="mb-4">用户管理</h2>
      </div>
    </div>

    <!-- 筛选和搜索 -->
    <div class="row mb-4">
      <div class="col-12">
        <div class="card">
          <div class="card-body">
            <div class="row">
              <div class="col-md-2 mb-3">
                <label class="form-label">角色</label>
                <select class="form-control" ng-model="$ctrl.filters.role" ui-select2="{placeholder: '全部角色', allowClear: true}">
                  <option value="">全部角色</option>
                  <option ng-repeat="role in $ctrl.roles" value="{{ role.value }}">{{ role.label }}</option>
                </select>
              </div>
              <div class="col-md-2 mb-3">
                <label class="form-label">部门</label>
                <select class="form-control" ng-model="$ctrl.filters.department" ui-select2="{placeholder: '全部部门', allowClear: true}">
                  <option value="">全部部门</option>
                  <option ng-repeat="dept in $ctrl.departments" value="{{ dept }}">{{ dept }}</option>
                </select>
              </div>
              <div class="col-md-2 mb-3">
                <label class="form-label">租户</label>
                <select class="form-control" ng-model="$ctrl.filters.tenant" ui-select2="{placeholder: '全部租户', allowClear: true}">
                  <option value="">全部租户</option>
                  <option ng-repeat="tenant in $ctrl.tenants" value="{{ tenant.id }}">{{ tenant.name }}</option>
                </select>
              </div>
              <div class="col-md-4 mb-3">
                <label class="form-label">搜索</label>
                <input type="text" class="form-control" ng-model="$ctrl.filters.search" 
                       placeholder="用户名、姓名、工号或邮箱">
              </div>
              <div class="col-md-2 mb-3 d-flex align-items-end">
                <button type="button" class="btn btn-primary me-2" ng-click="$ctrl.searchUsers()">
                  <i class="fas fa-search"></i> 搜索
                </button>
                <button type="button" class="btn btn-outline-secondary" ng-click="$ctrl.clearFilters()">
                  重置
                </button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 用户列表 -->
    <div class="row">
      <div class="col-12">
        <div class="card">
          <div class="card-header d-flex justify-content-between align-items-center">
            <h5 class="mb-0">用户列表</h5>
            <button type="button" class="btn btn-success" ng-click="$ctrl.showCreateUserForm()">
              <i class="fas fa-plus"></i> 新建用户
            </button>
          </div>
          <div class="card-body">
            <div class="table-responsive">
              <table class="table table-hover">
                <thead>
                  <tr>
                    <th>工号</th>
                    <th>用户名</th>
                    <th>姓名</th>
                    <th>邮箱</th>
                    <th>部门</th>
                    <th>角色</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  <tr ng-show="$ctrl.isLoading">
                    <td colspan="9" class="text-center">
                      <i class="fas fa-spinner fa-spin"></i> 加载中...
                    </td>
                  </tr>
                  <tr ng-show="!$ctrl.isLoading && $ctrl.users.length === 0">
                    <td colspan="9" class="text-center text-muted">暂无用户数据</td>
                  </tr>
                  <tr ng-repeat="user in $ctrl.users" ng-show="!$ctrl.isLoading">
                    <td>{{ user.employee_id || '-' }}</td>
                    <td>{{ user.username }}</td>
                    <td>{{ user.name }}</td>
                    <td>{{ user.email }}</td>
                    <td>{{ user.department || '-' }}</td>
                    <td>
                      <span class="badge" ng-class="$ctrl.getRoleBadgeClass(user.role)">
                        {{ $ctrl.getRoleText(user.role) }}
                      </span>
                    </td>
                    <td>
                      <span class="badge" ng-class="user.status === 'active' ? 'badge-success' : 'badge-secondary'">
                        {{ user.status === 'active' ? '正常' : '停用' }}
                      </span>
                    </td>
                    <td>{{ user.created_at | date:'yyyy-MM-dd HH:mm' }}</td>
                    <td>
                      <button type="button" class="btn btn-sm btn-outline-primary me-1">
                        <i class="fas fa-edit"></i>
                      </button>
                      <button type="button" class="btn btn-sm btn-outline-danger">
                        <i class="fas fa-trash"></i>
                      </button>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 创建用户模态框 -->
    <div class="modal-backdrop fade show" ng-show="$ctrl.showCreateForm"></div>
    <div class="modal fade show" style="display: block;" ng-show="$ctrl.showCreateForm">
      <div class="modal-dialog modal-lg">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title">新建用户</h5>
            <button type="button" class="btn-close" ng-click="$ctrl.hideCreateForm()"></button>
          </div>
          <div class="modal-body">
            <form name="$ctrl.userForm" ng-submit="$ctrl.createUser()" novalidate>
              <div class="row">
                <div class="col-md-6 mb-3">
                  <label class="form-label">用户名 <span class="text-danger">*</span></label>
                  <input type="text" class="form-control" name="username" 
                         ng-model="$ctrl.newUser.username" required
                         ng-class="{ 'is-invalid': $ctrl.userForm.username.$invalid && $ctrl.userForm.username.$touched }">
                  <div class="invalid-feedback" ng-show="$ctrl.userForm.username.$invalid && $ctrl.userForm.username.$touched">
                    请输入用户名
                  </div>
                </div>
                <div class="col-md-6 mb-3">
                  <label class="form-label">密码 <span class="text-danger">*</span></label>
                  <input type="password" class="form-control" name="password"
                         ng-model="$ctrl.newUser.password" required minlength="6"
                         ng-class="{ 'is-invalid': $ctrl.userForm.password.$invalid && $ctrl.userForm.password.$touched }">
                  <div class="invalid-feedback" ng-show="$ctrl.userForm.password.$invalid && $ctrl.userForm.password.$touched">
                    密码至少6位字符
                  </div>
                </div>
                <div class="col-md-6 mb-3">
                  <label class="form-label">姓名 <span class="text-danger">*</span></label>
                  <input type="text" class="form-control" name="name"
                         ng-model="$ctrl.newUser.name" required
                         ng-class="{ 'is-invalid': $ctrl.userForm.name.$invalid && $ctrl.userForm.name.$touched }">
                  <div class="invalid-feedback" ng-show="$ctrl.userForm.name.$invalid && $ctrl.userForm.name.$touched">
                    请输入姓名
                  </div>
                </div>
                <div class="col-md-6 mb-3">
                  <label class="form-label">邮箱 <span class="text-danger">*</span></label>
                  <input type="email" class="form-control" name="email"
                         ng-model="$ctrl.newUser.email" required
                         ng-class="{ 'is-invalid': $ctrl.userForm.email.$invalid && $ctrl.userForm.email.$touched }">
                  <div class="invalid-feedback" ng-show="$ctrl.userForm.email.$invalid && $ctrl.userForm.email.$touched">
                    请输入有效的邮箱地址
                  </div>
                </div>
                <div class="col-md-6 mb-3">
                  <label class="form-label">工号</label>
                  <input type="text" class="form-control" ng-model="$ctrl.newUser.employee_id">
                </div>
                <div class="col-md-6 mb-3">
                  <label class="form-label">部门</label>
                  <select class="form-control" ng-model="$ctrl.newUser.department" ui-select2="{placeholder: '请选择部门', allowClear: true}">
                    <option value="">请选择部门</option>
                    <option ng-repeat="dept in $ctrl.departments" value="{{ dept }}">{{ dept }}</option>
                  </select>
                </div>
                <div class="col-md-6 mb-3">
                  <label class="form-label">角色 <span class="text-danger">*</span></label>
                  <select class="form-control" ng-model="$ctrl.newUser.role" required ui-select2="{placeholder: '请选择角色', allowClear: false}">
                    <option ng-repeat="role in $ctrl.roles" value="{{ role.value }}">{{ role.label }}</option>
                  </select>
                </div>
                <div class="col-md-6 mb-3">
                  <label class="form-label">租户</label>
                  <select class="form-control" ng-model="$ctrl.newUser.tenant_id" ui-select2="{placeholder: '请选择租户', allowClear: true}">
                    <option value="">请选择租户</option>
                    <option ng-repeat="tenant in $ctrl.tenants" value="{{ tenant.id }}">{{ tenant.name }}</option>
                  </select>
                </div>
              </div>
            </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" ng-click="$ctrl.hideCreateForm()">取消</button>
            <button type="submit" class="btn btn-primary" ng-click="$ctrl.createUser()" 
                    ng-disabled="$ctrl.isLoading || $ctrl.userForm.$invalid">
              <span ng-show="$ctrl.isLoading">
                <i class="fas fa-spinner fa-spin"></i> 创建中...
              </span>
              <span ng-hide="$ctrl.isLoading">创建用户</span>
            </button>
          </div>
        </div>
      </div>
    </div>